home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-12 | 2.3 KB | 56 lines | [TEXT/GEOL] |
- Item 8843225 11-Jan-90 00:14
-
- From: FALK2 Austria - Alexander Falk
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Instantiation “by classname”?
-
- Hi,
-
- This is a purely “philosophical” question, but it is somehow connected with
- the previous discussion on cloning in MacApp.
-
- Can anyone enlighten me, why there is a need to instantiate an object “by
- classname” in MacApp? I’m talking about the RegisterStdType("TWhateverView"...)
- procedure, where you tell MacApp about your new view class, so that it can
- later create an object of that class to show it in your document (see
- UNothing.cp).
-
- In my opinion this technique has several drawbacks:
-
- •) It is NOT a very nice OOP technique.
-
- •) The linker doesn’t know that this class is actually used and tries
- to dead-strip it’s code, so there is need for the “gDeadStripSuppresion”
- trick (which is VERY kludgy).
-
- •) This very “gDeadStripSuppresion” trick can create a lot of confusion for
- people, who have previously used OOP languages, but haven’t used MacApp
- before. For example I suspected that gDeadStripSuppression would always
- be true, until this problems was fixed. And so I was very surprised,
- that in the C++ sample the object created there was never actually being
- deleted again (I know, I should have read the manual....).
-
- Wouldn’t it be simpler if instead of calling RegisterStdType("classname"...)
- in the IWhateverApplication the application object would instantiate an object
- for that special view class itself and pass it to MacApp. MacApp could then
- easily clone this object whenever it needs one (now we are back at the previous
- discussion on how to clone an object).
-
- This might be a way more coherent with the OOP paradigm than the current
- technique. And it would immediately solve the problem of preventing the linker
- from dead-stripping the methods of this class! So instead of calling
- RegisterStdType( "\pTWhateverView", ... ) in the future you’d write
-
- TWhateverView* MyView = new TWhateverView;
- RegisterStdType( MyView, ... );
-
- Am I being too simpleminded here and do I overlook some sideeffects or
- special benefits of the current technique of instantiation “by classname”?
-
- Regards,
-
- Alexander Falk
-
-